﻿using System;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;

namespace Gumini.JulaDB.Navigator.Logic
{
    public class Command : RelayCommand, ICommand
    {
        public Command(Action execute, Func<bool> canExecute)
            : base(execute, canExecute) { }
    
        public Command(Action execute)
            : base(execute) { }
    
        public new void RaiseCanExecuteChanged()
        {
            CommandManager.InvalidateRequerySuggested();
        }

        bool ICommand.CanExecute(object parameter)
        {
            return base.CanExecute(parameter);
        }

        event EventHandler ICommand.CanExecuteChanged
        {
            add { CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value; }
        }

        void ICommand.Execute(object parameter)
        {
            base.Execute(parameter);
        }
    }
}
